<?php
namespace App\Http\Controllers\Api;

use App\Http\Controllers\Controller;
use think\Cache;

class BaseController extends Controller{
    //不进行token验证的接口
    protected $publicApi = [];
    //构造函数
    public function __construct()
    {
        $this->param = request()->all();
        $action = \Route::current()->getActionName();
        list($class, $method) = explode('@', $action);
        $class = substr(strrchr($class,'\\'),1);
        //公共参数
        $this->token = isset($this->param['token'])?$this->param['token']:appMessage(11,'缺少必须参数token');
        if (!in_array($method,$this->publicApi)) {
            $this->userInfo = checkToken($this->token);
        }
    }
}